<template>
	<view>
		<web-view :src="webViewLink"></web-view>
	</view>
</template>

<script>
	const globalData = getApp().globalData;
	const getWebSrcURL = globalData.global_url + "/link/landpage"
	export default {
		data() {
			return {
				webViewLink:''
			}
		},
		onLoad(options) {
			console.log(options)
			// this.webViewLink = options.webviewsrc
			this.getWebSrc()
			// this.webViewLink = `https://www.baidu.com?id=${options.link}#wechat_redirect`
		},
		onShow(res){
			console.log(res)
			console.log(res?res.query.game:'');
		},
		methods: {
			getWebSrc() {
				let params = {
					time: Date.parse(new Date())
				}
				uni.request({
					url: getWebSrcURL,
					data: params
				}).then(data => {
					var [error, res] = data;
					console.log(res.data);
					if (res.data.errno === '000') {
						this.webViewLink = res.data.result.loadurl+'#wechat_redirect'
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style>

</style>
